package cn.saltybe.analysis.crawler.wbtc.secondHandHouse;

import cn.saltybe.analysis.crawler.wbtc.common.WbtcHouseImage;
import com.geccocrawler.gecco.annotation.*;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.spider.SpiderBean;

import java.util.List;

@Gecco(
        matchUrl = {
                "https://{}.58.com/ershoufang/{id}x.shtml",
                "https://{}.58.com/ershoufang/{id}x.shtml?auction={}&hpType={}&entry={}&position={}&kwtype={}&now_time={}&typecode={}&lg={}",
                "https://{}.58.com/ershoufang/{id}x.shtml?auction={}&hpType={}&entry={}&position={}&kwtype={}&now_time={}&typecode={}&spread={}&from={}&index={}"
        },
        pipelines = { "wbtcSecondHandHousePipeline" },
        downloader = "htmlUnitDownloader")
public class WbtcSecondHandHouse implements SpiderBean {
    @Request
    private HttpRequest request;

    public HttpRequest getRequest() {
        return request;
    }

    public void setRequest(HttpRequest request) {
        this.request = request;
    }

    @RequestParameter
    private String id;

    @Text
    @HtmlField(cssPath = "#__layout > div > div.props-main > div.banner > div.banner-title > h1")
    private String title;

    @Text
    @HtmlField(cssPath = "#__layout > div > div.props-main > div.props-body > div.props-right > div.maininfo > div.maininfo-price > div.maininfo-price-wrap > span.maininfo-price-num")
    private String price;

    @Text
    @HtmlField(cssPath = "#__layout > div > div.props-main > div.props-body > div.props-right > div.maininfo > div.maininfo-meta > div.maininfo-community > div:nth-child(2) > span.maininfo-community-item-name > a:nth-child(1)")
    private String district;

    @Text
    @HtmlField(cssPath = "#__layout > div > div.props-main > div.props-body > div.props-right > div.maininfo > div.maininfo-meta > div.maininfo-community > div:nth-child(1) > a.anchor.anchor-weak")
    private String address;

    @Image
    @HtmlField(cssPath = "#__layout > div > div.props-main > div.props-body > div.props-left > section > div.gallery-indicator > div.gallery-indicator-image-wrap.slick-initialized.slick-slider > div > div > div")
    private List<String> image;

    @Text
    @HtmlField(cssPath = "#__layout > div > div.props-main > div.props-body > div.props-right > div.maininfo > div.maininfo-model > div.maininfo-model-item.maininfo-model-item-2 > div.maininfo-model-strong > i")
    private String square;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getDistrict() { return district; }

    public void setDistrict(String district) { this.district = district; }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public List<String> getImage() { return image; }

    public void setImage(List<String> image) { this.image = image; }

    public String getSquare() {
        return square;
    }

    public void setSquare(String square) {
        this.square = square;
    }
}
